﻿
@{
    int type = 1;
    string types = Request["type"] ==null? "1": Request["type"].ToString();
    int.TryParse(types, out type);
    ViewBag.Title = type == 1 ? "分销收益" : type == 2 ? "课程收益" : "店铺收益";
    Layout = "~/Views/Shared/_MallLayout.cshtml";
}
@model token_wallet_detail_dto

<body class="page-center page-fxsBill page-billManage page-earnings" id="mescroll">

    @*<div class="lt-head">
            <a href="javascript:history.go(-1);">
                <i class="icon-back fn-left"></i>
            </a>
            <span class="center">分销收益</span>
        </div>*@
    <!--header end-->

    <div class="property ">
        <div class="content fn-center">
            <p class="fn24">总资产</p>
            <div class="money fn-bold">
                @Model.money<em class="fn40">￥</em>
            </div>
            <div class="mb50">
                <a href="/mybill/transfer?type=@type" class="ui-btn-white" id="tx">提现</a>
            </div>
        </div>

        <div class="drawings lt-box">
            <div class="left">
                <p class="fn36">@Model.deposit</p>
                <p class="fn24">可提现（元）</p>
            </div>
            <div class="right">
                <p class="fn36">@Model.deposting</p>
                <p class="fn24">@if (type == 2) {<text>提现中（元）</text>} else { <text> 冻结中（元）</text>}</p>
            </div>
        </div>
    </div>
    @if (type != 2) {
        <div class="mod-type mod-typeTab">
            <ul id="tab">
                <li class="cur">
                    已结算
                    <i></i>
                </li>
                <li>未结算<i></i></li>
            </ul>
        </div>

    }
    <div id="tabList">
        <div class="mod-table lt-mb j-tabList mescroll">
            <ul>
                @if (type == 2) {

                    <li>
                        <div class="td" style="width:45% "><div class="tdfirst">昵称/用户</div></div>
                        <div class="td" style="width:35% ">金额</div>
                        <div class="td">时间</div>
                    </li>



                } else {
                    <li>
                        <div class="td" style="width:55% "><div class="tdfirst">商品名称/时间</div></div>
                        <div class="td" style="width:25% ">金额</div>
                        <div class="td">状态</div>
                    </li>
                }
            </ul>
            <ul id="wallet"></ul>

        </div>
        @*<div class="mod-table lt-mb j-tabList none">
                2222
            </div>*@
    </div>

    <a class="goTop">
        <img src="~/Content/css/tokenmall/img/icon/goTop.png" />
    </a>
    <link href="~/Scripts/mescroll/mescroll.min.css" rel="stylesheet" />
    <script src="~/Scripts/mescroll/mescroll.min.js"></script>
    <script>
        $(function () {
            var status = 2;
            var mescroll = new MeScroll("mescroll", {
                down: {
                    auto: false,
                    callback: function (mescroll) {
                        mescroll.resetUpScroll(); //下拉刷新的回调,默认重置上拉加载列表为第一页
                    }
                },
                up: {
                    callback: getListData,
                    clearEmptyId: "wallet",
                    isBounce: false,
                    noMoreSize: 3,
                    htmlNodata: '<p class="upwarp-nodata">--没有更多数据了 --</p >',
                    empty: {
                        warpId: "wallet",
                        icon: "",
                        tip: "亲,没有您要找的数据~"

                    },
                    //toTop: {
                    //    src: "/Content/css/tokenmall/img/toup.png",
                    //    html: " <img src='/Content/css/tokenmall/img/toup.png' />",
                    //    offset: 500
                    //}
                }
            });

            function getListData(page) {
                console.log("page.num=" + page.num + ", page.size=" + page.size);
                $.ajax({
                    type: 'post',
                    url: '/MyBill/_WalletDetail',
                    data: { page: page.num, size: page.size, status: status, type:@type },
                    success: function (response) {
                        var paged = $(response).siblings("page");
                        var rows = Number.parseInt(paged.attr("rows"));
                        var total = Number.parseInt(paged.attr("total_result"));
                        mescroll.endBySize(rows, total);
                        if (paged.length === 1) {
                            $("#wallet").append($(response));
                            $('#wallet page').remove();
                        }

                    },
                    error: function (e) {
                        //联网失败的回调,隐藏下拉刷新和上拉加载的状态
                        mescroll.endErr();
                    }
                });
            }
            $("#tab").on("click", "li", function () {
                var index = $(this).index();
                status = (index === 0) ? 2 : 1;
                $(this).addClass("cur").siblings().removeClass("cur");
               // $("#tabList .j-tabList").eq(index).removeClass("none").siblings().addClass("none");
                //重置列表数据
                mescroll.resetUpScroll();
                //隐藏回到顶部按钮
                mescroll.hideTopBtn();
            });
        });
    </script>
</body>

